# Zet initieel in de code:
# BIMODAL_INDEX_BITS op 10 (was 16)
# GSHARE_HISTORY_LENGTH op 10 (was 10)
# GSHARE_TABLE_BITS op 10 (was 19)

for BIB in {10..15} # BIMODAL_INDEX_BITS van 10 tem 28
do

for GHL in {8..12} # GSHARE_HISTORY_LENGTH
do

for GTB in {17..20} # GSHARE_TABLE_BITS
do

for THR in {0..5}
do

for TIM in {0..10}
do

cd src/
zoekstring0="#define BIMODAL_INDEX_BITS [10-15]*"
zoekstring1="#define GSHARE_HISTORY_LENGTH [8-12]*"
zoekstring2="#define GSHARE_TABLE_BITS [17-20]*"
zoekstring3="#define THRESHOLD [0-5]*"
zoekstring4="#define TIMEOUT [0-10]*"

vervangstring0="#define BIMODAL_INDEX_BITS $BIB"
vervangstring1="#define GSHARE_HISTORY_LENGTH $GHL"
vervangstring2="#define GSHARE_TABLE_BITS $GTB"
vervangstring3="#define THRESHOLD $THR"
vervangstring4="#define TIMEOUT $TIM"

sed -i ".backup" "s/$zoekstring0/$vervangstring0/" my_predictor.h
sed -i ".backup" "s/$zoekstring1/$vervangstring1/" my_predictor.h
sed -i ".backup" "s/$zoekstring2/$vervangstring2/" my_predictor.h
sed -i ".backup" "s/$zoekstring3/$vervangstring3/" my_predictor.h
sed -i ".backup" "s/$zoekstring4/$vervangstring4/" my_predictor.h

make
cd ../
echo -n "Settings: $BIMODAL_INDEX_BITS BIB - GSHARE_HISTORY_LENGTH $GHL - GSHARE_TABLE_BITS $GTB - THRESHOLD $THR - TIMEOUT $TIM, "
run traces | grep 'average MPKI:'

done
done
done
done
done
